package com.example.demo.controller;

import com.example.demo.service.MenuServcie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/menu")
public class MenuController {

    //由spring创建对象替代 MenuService menuService=new MenuServiceImpl()
    @Autowired
    MenuServcie menuServcie;
    //查看菜单
    @GetMapping("/show")// localhost:8085/menu/show
    public String showAllMenu(){
        //return "查看所有菜单";
        String res=menuServcie.showMenu();
        return res;
    }

    //添加菜单
    @GetMapping("/add")
    public String addMenu(){
        return "添加菜单";
    }

}